/**
 *  This file is part of AugeasWH.
 *
 *  AugeasWH. is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  AugeasWH. is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with AugeasWH.  If not, see <http://www.gnu.org/licenses/>.
 */

package cz.fit.vutbr.pis2012.augeaswh.control.whman.slot_stock_items;

import java.io.Serializable;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;

import cz.fit.vutbr.pis2012.augeaswh.persistence.SlotsStockItem;
import cz.fit.vutbr.pis2012.augeaswh.persistence.StockItem;

@ManagedBean
@ViewScoped
public class SlotStockItemConfirmDeleteDialog implements Serializable {

private static final long serialVersionUID = 1L;
	
	private StockItem stockItem;
	private SlotsStockItem slotStockItem;
	
	public SlotStockItemConfirmDeleteDialog() {
		stockItem = null;
		slotStockItem = null;
	}
	
	public StockItem getStockItem() {
		return stockItem;
	}
	public void setStockItem(StockItem stockItem) {
		this.stockItem = stockItem;
	}
	
	public SlotsStockItem getSlotStockItem() {
		return slotStockItem;
	}

	public void setSlotStockItem(SlotsStockItem slotStockItem) {
		this.slotStockItem = slotStockItem;
	}

	public String getTitle() {
		return "Delete slot stock item item";
	}
	
	public String getQuestion() {
		return "Are you sure that you want to delete selected slot stock item?";
	}
	
	public void submit() {
		if (stockItem == null || slotStockItem == null)
			return;
		stockItem.removeSlotStockItem(slotStockItem);
		stockItem = null;
		slotStockItem = null;
	}
}
